<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ include file="/WEB-INF/views/shared/taglib.jsp"%>

<style>	

</style>

	<div class="weui-cells" style="margin-bottom: 0px;padding-top:0px;margin-top: 0px">
		<c:if test="${empty goldenBeanDetails}">
		<div class="weui-panel_body" style="text-align: center;">
			<img alt="" src="<c:url value='/images/we/personCenter/null.png' />">
			<p style="margin: 5px 20px;color: #afafaf">空空如也...</p>
		</div>
	  </c:if>
		<c:forEach var="goldenBeanDetail" items="${goldenBeanDetails}">
	
				<div class="weui-cell businessDetail" style="border-bottom:1px solid #e5e5e5">
				<div class="weui-cell__bd">
					<p><t:provider packageName="acc" enumClassName="GoldenBeanType" value="${goldenBeanDetail.goldenBeanType}"/></p>
					<span style="font-size: 12px;color:#c4b2b2;"> 
						<fmt:formatDate value="${goldenBeanDetail.time}" pattern="yyyy-MM-dd HH:mm:ss"/>
					</span>
				</div>
				<div class="weui-cell__ft">
					<input type="hidden" class="state" value="${goldenBeanDetail.state}" />
					<p style="font-size: 16px">
					<c:if test="${goldenBeanDetail.state == 'income'}">
					    <span id="plusMinus" >
					    +<span  class="bonusMoney">${goldenBeanDetail.goldenBeanAccount}</span>金豆	</span>
				    </c:if>
				    <c:if test="${goldenBeanDetail.state == 'pay'}"> 
					    <span id="plusMinus" >
					    -<span  class="bonusMoney">${goldenBeanDetail.goldenBeanAccount}</span>金豆	</span>
				    </c:if>
						
					</p>
				</div>
				</div>

	<input type="hidden" class="commercial" value="${goldenBeanDetail.commercialInsurance}" />			

	<c:if test="${goldenBeanDetail.commercialInsurance > 0}">
	<div class="business" hidden style="border-bottom:1px solid #e5e5e5">
	<div class="weui-cell">
		<div class="weui-cell__bd" style="color:#afafaf;">
			<label for="" class="weui-label" >订单总保费</label>
		</div>
		<div class="weui-cell__ft" >
		<span> ${goldenBeanDetail.commercialInsurance}</span>元
		</div>
	</div>
	<div class="weui-cell">
		<div class="weui-cell__bd" style="color:#afafaf;">
			<label for="" class="weui-label">订单奖金比例</label>
		</div>
		<div class="weui-cell__ft" >
		<span style="padding-right:10px">×</span><span id="percent">${goldenBeanDetail.percent}</span>
		</div>
	</div>
	<div class="weui-cell">
		<div class="weui-cell__bd" style="color:#afafaf;">
			<label for="" class="weui-label">兑换金豆比例</label>
		</div>
		<div class="weui-cell__ft" >
		<span style="padding-right:10px">×</span><span>100</span>
		</div>
	</div>
	<div class="weui-cell" style="color:red;">
		<div class="weui-cell__bd" style="color:#afafaf;">
			<label for="" class="weui-label">您的奖励金豆</label>
		</div>
		<div class="weui-cell__ft">
		<span class="bonusMoney">${goldenBeanDetail.commercialInsurance * goldenBeanDetail.percent * 100} </span>金豆
		</div>
	</div>
	<a class="weui-cell" href="<c:url value='/wechat/acc/myWealth/bonus?id=${goldenBeanDetail.id}' />">
	<span style="width:100%;text-align:center;color:blue">查看订单详情</span>
	</a>
</div>
</c:if>
<input type="hidden" class="bonusDetailId" value="${goldenBeanDetail.id}" />	
</c:forEach>
			
	</div> 

	<div class="weui-cells " style="margin-top:4em">
		<div class="weui-cell weui-tabbar">
			<div class="weui-cell__bd " style="font-size:16px">
				<p style="font-size: 18px;color: #333">总收入</p>
				<span style="color: #999; font-size: 16px">￥<fmt:formatNumber value="${incomeMoney}" pattern="#" minFractionDigits="0" > </fmt:formatNumber></span>	
			</div>
			<div class="weui-cell__ft " style="padding-right:25px">
				<p style="font-size: 18px;color: #333">总支出</p>
				<span style="color: #999; font-size: 16px">￥<fmt:formatNumber value="${expendMoney}" pattern="#" minFractionDigits="0" > </fmt:formatNumber></span>
			</div>
		</div>
	</div>

<script type="text/javascript">
$(function(){
	var checktime = 0;
	/* 记录列表是否点击 */
	$(".businessDetail").on("click",function(){
		var commercial=$(this).next().val();
		var bonusDetailId=$(this).next().next().val();
		/* alert(bonusDetailId); */
		if(checktime==0 && commercial>0){
			 $(this).next().next().show(); 
			 checktime = 1;
		}else if(checktime == 1 && commercial>0){
			 $(this).next().next().hide();
			 checktime=0;
		}else if(commercial <=0){
			window.location.href="<c:url value='/wechat/acc/myWealth/bonus?id="+bonusDetailId+"' />";
		}
		/*  $(this).next().toggle(300);  */
	});
});

$(".bonusMoney").each(function(){
	$(this).text(parseInt($(this).text()));
});

</script>	
